home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / Resound / ConsoleManager.m < prev    next >
Encoding:
Text File  |  1992-06-13  |  3.2 KB  |  175 lines

  1.  
  2.  
  3. #import "ConsoleManager.h"
  4. #import "Imports.h"
  5.  
  6. @implementation ConsoleManager
  7.  
  8. - SetMeterTo: ThisSound
  9. {
  10.         [Meter setSound: ThisSound];
  11.         [Meter lockFocus];
  12.         [Meter run:self];
  13.         return self;
  14. }
  15.  
  16. - PlayDown:sender
  17. {
  18.     if (    ([TheFileController CurrentWindow:self]!=NULL)&&
  19.             (! [TheSoundManager IsPlaying])&&
  20.         (! [TheSoundManager IsRecording])    )
  21.     {    
  22.     [TheSoundManager Play:self];
  23.     }
  24.     else
  25.         {
  26.         [PlayButton setState:(![PlayButton state])];
  27.     }
  28.  
  29.     return self;
  30. }
  31.  
  32. - LeftSoundUp:sender
  33. {
  34.     float left;
  35.     float right;
  36.     
  37.     [Sound getVolume:&left:&right];
  38.     if     (left<=.9)
  39.           {left+=.1;}
  40.     else
  41.         {left=1.0;}
  42.     [Sound setVolume:left:right];
  43.     return self;
  44. }
  45.  
  46. - RightSoundUp:sender
  47. {
  48.     float left;
  49.     float right;
  50.     
  51.     [Sound getVolume:&left:&right];
  52.     if     (right<=.9)
  53.           {right+=.1;}
  54.     else
  55.         {right=1.0;}
  56.     [Sound setVolume:left:right];
  57.     return self;
  58.  
  59. }
  60.  
  61. - LeftSoundDown:sender
  62. {
  63.     float left;
  64.     float right;
  65.     
  66.     [Sound getVolume:&left:&right];
  67.     if     (left>=.1)
  68.           {left-=.1;}
  69.     else
  70.         {left=0.0;}
  71.     [Sound setVolume:left:right];
  72.     return self;
  73. }
  74.  
  75. - RightSoundDown:sender
  76. {
  77.     float left;
  78.     float right;
  79.     
  80.     [Sound getVolume:&left:&right];
  81.     if     (right>=.1)
  82.           {right-=.1;}
  83.     else
  84.         {right=0.0;}
  85.     [Sound setVolume:left:right];
  86.     return self;
  87. }
  88.  
  89.  
  90. - RecordDown:sender
  91. {
  92.     if (    (! [TheSoundManager IsPlaying])&&
  93.         (! [TheSoundManager IsRecording]))
  94.         {    
  95.         if ([TimedRecordButton intValue])
  96.             {
  97.             if ([FortyMonoButton intValue])
  98.                 {
  99.                 [TheSoundManager Record: SND_RATE_HIGH: (int) 1: [SecondsField intValue]: sender];
  100.                 }
  101.             else if ([FortyStereoButton intValue])
  102.                 {
  103.                 [TheSoundManager Record: SND_RATE_HIGH: (int) 2: [SecondsField intValue]: sender];
  104.                 }
  105.             else if ([TwentyMonoButton intValue])
  106.                 {
  107.                 [TheSoundManager Record: SND_RATE_LOW: (int) 1: [SecondsField intValue]: sender];
  108.                 }
  109.             else if ([TwentyStereoButton intValue])
  110.                 {
  111.                 [TheSoundManager Record: SND_RATE_LOW: (int) 2: [SecondsField intValue]: sender];
  112.                 }
  113.             else if ([MuLawButton intValue])
  114.                 {
  115.                 [TheSoundManager Record: SND_RATE_CODEC: (int) 1: [SecondsField intValue]: sender];
  116.                 }
  117.             }
  118.         else
  119.             {
  120.             if ([FortyMonoButton intValue])
  121.                 {
  122.                 [TheSoundManager Record: SND_RATE_HIGH: (int) 1: 0: sender];
  123.                 }
  124.             else if ([FortyStereoButton intValue])
  125.                 {
  126.                 [TheSoundManager Record: SND_RATE_HIGH: (int) 2: 0: sender];
  127.                 }
  128.             else if ([TwentyMonoButton intValue])
  129.                 {
  130.                 [TheSoundManager Record: SND_RATE_LOW: (int) 1: 0: sender];
  131.                 }
  132.             else if ([TwentyStereoButton intValue])
  133.                 {
  134.                 [TheSoundManager Record: SND_RATE_LOW: (int) 2: 0: sender];
  135.                 }
  136.             else if ([MuLawButton intValue])
  137.                 {
  138.                 [TheSoundManager Record: SND_RATE_CODEC: (int) 1: 0: sender];
  139.                 }
  140.             }
  141.     }
  142.     else
  143.         {
  144.         [RecordButton setState:(![RecordButton state])];
  145.     }
  146.  
  147.     return self;
  148. }
  149.  
  150. - StopDown:sender
  151. {
  152.     [TheSoundManager Stop:self];
  153.     [RecordButton setState:0];
  154.     [PlayButton setState:0];
  155.     [StopButton setState:0];
  156.     return self;
  157. }
  158.  
  159. -TurnOffPlay
  160. {
  161.     [Meter stop:self];
  162.     [PlayButton setState:0];
  163.     return self;
  164. }
  165.  
  166. - TurnOffRecord
  167. {
  168.     [Meter stop:self];
  169.     [RecordButton setState:0];
  170.     return self;
  171. }
  172.  
  173.  
  174. @end
  175.